package com.cms.recursoshumanos.handler;

import com.cms.recursoshumanos.activity.main.MainRecursosHumanosActivity;
import com.cms.recursoshumanos.cache.UserInfoCache;
import com.cms.recursoshumanos.constant.Constant;
import com.cms.recursoshumanos.facade.DetailPolizaActivityFacade;
import com.cms.recursoshumanos.facade.ListaHospitalFamiliarScreenFacade;
import com.cms.recursoshumanos.facade.PlanillaCartaAvalActivityFacade;
import com.cms.recursoshumanos.object.Familiar;
import com.cms.recursoshumanos.object.Hospital;
import com.cms.recursoshumanos.object.Poliza;

public class DetailPolizaActivityHandler
{
	
	public String facadeDetailSeguro(String username, String pass)
	{
		DetailPolizaActivityFacade lista_poliza_facade = new DetailPolizaActivityFacade(username,pass);
		
		return lista_poliza_facade.enviarSolicitud();
	}
	public String refreshDetailPoliza (String username, String password )
	{
		return this.facadeDetailSeguro(username, password);
	}
	public String getDetailPoliza (String username, String password)
	{

		if (!UserInfoCache.getInstance().cache_utilizable(6, MainRecursosHumanosActivity.getAppContext())
			|| UserInfoCache.getInstance().getPoliza() == null)
		{
			return facadeDetailSeguro(username, password);
		}
		else
		{
			return Constant.CODE_OK;
		}
	
	}
	
	public String getPlanillaCartaAval(String username, String password, Poliza laPoliza, 
										String nombre_operation, String monto, Hospital elHospital, 
										Familiar elFamiliar)
	{

		PlanillaCartaAvalActivityFacade facade = new PlanillaCartaAvalActivityFacade(username,
																					password,
																					laPoliza.getIdPoliza(),
																					elFamiliar.getIdFamiliar(),
																					elHospital.getIdHospital(),
																					nombre_operation,monto);
		return facade.enviarSolicitud();
	}
	
	public String getListaHospitalBeneficiarios(String username, String password, Poliza laPoliza)
	{
		
			ListaHospitalFamiliarScreenFacade facade = new ListaHospitalFamiliarScreenFacade(username, 
																								password, 
																								laPoliza);
			return facade.enviarSolicitud();
	
	}
	
}

